
 beginoutdoorscript;

 variables;

 int i,j,k,r1,choice;

 body;

 beginstate INIT_STATE;
	if ((get_flag(6,5) == 1) || (get_flag(6,5) == 5))
		eliminate_outdoor_enc(110,7);
	break;

 beginstate START_STATE;
	if (get_flag(3,2) == 0)
		set_terrain(9,22,0);
	if (get_flag(3,2) == 1)
		set_terrain(9,22,302);

	if ((get_flag(6,5) == 1) || (get_flag(6,5) == 5))
		eliminate_outdoor_enc(110,7);


	break;

beginstate 10;
	if (get_flag(110,0) == 0)
		block_entry(1);

	if (get_flag(110,0) == 1) {
		message_dialog("You only found something because you were determined to look. Thick vegetation covers the narrow pass, which was barely wide enough for one man to pass. The ogres must have real troubles going through it.","Once you make it to the other side you are greeted by a constructed stone wall only a couple of hundred yards ahead. A large gap in the wall is your only entrance to what looks like a fort occupied by several ogres.");
		set_flag(110,0,2);
}
 break;

beginstate 11;
	if (get_flag(110,1) == 0) {
		reset_dialog();
		add_dialog_str(0,"This used to be an Empire fort. It has been completely destroyed. It never had any kind of a palisade, only four watchtowers. The north tower has collapsed. You guess the ogres simply overwhelmed the fort's defenders.",0);
		add_dialog_str(1,"You cautiously look around the fort, trying to make sense of the battle. Oddly enough, there are not that many bodies, ogre or human, to be found. There are only three soldiers and no ogre bodies. However, blood splatters are everywhere.",0);
		add_dialog_str(2,"The whole fort has an eerie atmosphere.",0);
		add_dialog_choice(0,"Leave the grisly sight.");
		add_dialog_choice(1,"See if you can find something useful on the bodies or anywhere.");
		choice = run_dialog(1);

		if (choice == 2) {
			if (get_flag(0,13) == 0) {
				message_dialog("You search the remains of the fort. Apparently the ogres have already looted it, so you do not find much. The ogres left behind some barterable goods, a few torches. There are also some short swords and bucklers,","But they are of mediocre quality at best so you leave them behind. The only good stuff is on the three bodies. You find some potions, a serviceable sword and a pair of magic boots.");
				change_coins(55);
				reward_give(220);
				reward_give(220);
				reward_give(223);
				reward_give(57);
				reward_give(115);
				reward_give(171);
				reward_give(171);
				set_flag(110,1,1);
	}
			if (get_flag(0,13) == 1) {
				message_dialog("You begin to search the remains of the fort. It looks like the ogres have already cleared it of most of the valuables, though. You do find something of use, but then a series of protests from the soldiers prevents you from taking it.","It would appear that they are averse to looting the property of their fallen comrades and Empire property. You will have to leave the fort the way it is for now.");
				block_entry(1);
	}
}
}
 break;

beginstate 12;
	reset_dialog();
	add_dialog_str(0,"You saw the battlefield from miles away. The ogres were visible from afar too. So you made very sure that they did not see you. Moving behind cover you managed to sneak within earshot of the ogres. They are busy looting the battlefield.",0);
	add_dialog_str(1,"It seems there was a lot to loot. The battle was fought between ogres and a caravan envoy consisting of three wagons which are now wrecked and burned.  Magical residue still fizzles and crackles here and there.",0);
	add_dialog_str(2,"There are about a dozen ogres altogether and they are all surrounding one of the wagons; the other two have apparently been looted already. They are talking to each other in gruff, clipped sentences. What to do next?",0);
	add_dialog_choice(0,"Attack the ogres!");
	add_dialog_choice(1,"Listen to what the ogres are saying.");
	add_dialog_choice(2,"Sneak away.");
	choice = run_dialog(1);

	if (choice == 1)
		message_dialog("You spring from your cover, taking the ogres by surprise! They quickly organize a defensive line and the battle begins!","");

	if (choice == 2) {
		reset_dialog();
		add_dialog_str(0,"The ogres talk is not exactly intellectually stimulating, which is hardly surprising. It is mostly about food, fighting and fornication. Something they say is a bit odd, though. _Great Witch help ogre people win!_ one of them says.",0);
		add_dialog_str(1,"_Yes!_ Another one agrees. _With Angerfist. With Great Witch. We crush humuns!_ At this point they all start brandishing their weapons and roar to the skies. Then they go back to looting and resume their mindless chatter.",0);
		add_dialog_choice(0,"Attack the ogres!");
		add_dialog_choice(1,"Sneak away.");
		choice = run_dialog(1);

			if (choice == 1)
				message_dialog("You spring from your cover, taking the ogres by surprise! They quickly organize a defensive line and the battle begins!","");

			if (choice == 2) {
				outdoor_enc_result(1);
				message_dialog("You quietly sneak away while the ogres resume their looting.","");
				}
			}

	if (choice == 3) {
		outdoor_enc_result(1);
		message_dialog("You quietly sneak away while the ogres resume their looting.","");
	}

 break;

beginstate 13;
	if (get_flag(110,2) == 1)
		end();

	reset_dialog();
	add_dialog_str(0,"There was a cottage near the mine. You explored it. It was looted and most of it was burned, clearly the work of ogres, the tracks around the cottage alone verified that. You left the cottage. A trail of footsteps lead from the cottage to this mine.",0);
	add_dialog_str(1,"You notice tracks upon tracks in front of the entrance. The tracks speak of all kinds of creatures: large humanoid, regular humanoid and four-legged beast. It is dark inside and there is no telling what lies within.",0);
	add_dialog_choice(0,"Enter the mine.");
	add_dialog_choice(1,"Leave.");
	choice = run_dialog(1);

	if (choice == 1) {
		reset_dialog();
		add_dialog_str(0,"You enter the mine. Soon natural light no longer illuminates your path. All is dark. You are about to make a grab for a torch when something snarls not far from you. You freeze, fumbling to light the torch when something furry brushes against you.",0);
		add_dialog_str(1,"A javelin whooshes past your head. The surroundings are not beneficial for you so you sprint towards the light while your unseen enemy gives chase. You reach the sunlight and turn around to face your enemy.",0);
		add_dialog_str(2,"They consist of a group of worgs and two ogres.",0);
		run_dialog(1);
		create_out_spec_enc(0);
}
 break;

beginstate 14;
	message_dialog("You are victorious. You re-enter the mine, even more cautiously this time. You find a fire burning around a corner and a torch which helps you light the way.","Unfortunately, there is nothing of value in this mine. Whoever owns it mined copper and the vein was not even that rich. You move on.");
	set_flag(110,2,1);
 break;

beginstate 15;
	reset_dialog();
	add_dialog_str(0,"Here the road leads north away from Quarhag Pass. You are free to continue your journey to Sharimik and see if you can still get hired for that interesting job there. Do you want to leave Quarhag Pass now?",0);
	add_dialog_choice(0,"Not quite yet.");
	add_dialog_choice(1,"Yes. (Leave the scenario)");
	choice = run_dialog(1);

	if (choice == 1)
		block_entry(1);

	if (choice == 2) {

	if (get_flag(7,7) != 5) {

		if ((get_flag(5,11) == 0) && (get_flag(6,5) == 0)) {
			reset_dialog();
			add_dialog_str(0,"You did not slay the ogre chieftain and apparently did not really care about the events in the pass. You only wanted to Sharimik which is where you wound up. You got the job you wanted and finished it.",0);
			add_dialog_str(1,"Later you found out that Passton was destroyed, but the Empire managed to defeat the ogres eventually. They never stood a chance.",0);
			add_dialog_choice(0,"THE END");
			run_dialog(1);
	}

		if ((get_flag(5,11) >= 1) && (get_flag(6,5) == 0)) {
			reset_dialog();
			add_dialog_str(0,"You are victorious! You killed the ogre chief and a good portion of the rest of the ogres. Your slight detour has come to an end and you can now continue your journey to Sharimik. An interesting job awaits.",0);
			add_dialog_str(1,"Days went by uneventfully and you arrived at your destination. Your job was still on the notice board; you took it and took to the road again. Weeks went by and word reached you that an insane mage burned down Passton and killed everyone there.",0);
			add_dialog_choice(0,"THE END");
			run_dialog(1);
	}

		if ((get_flag(5,11) >= 1) && (get_flag(6,5) == 1)) {
			reset_dialog();
			add_dialog_str(0,"You are victorious! You killed the ogre chief and the insane wizard behind the ogres' attack. Your slight detour has come to an end and you can know continue your journey to Sharimik. An interesting job awaits.",0);
			add_dialog_str(1,"Days went by uneventfully and you arrived at your destination. Your job was still on the notice board; you took it and took to the road again. The mission turned out to be a tricky one, but that is a tale for another day.",0);
			add_dialog_choice(0,"THE END");
			run_dialog(1);
	}
		end_scenario(1);
	}

	if (get_flag(7,7) == 5) {

		if ((get_flag(5,11) >= 1) && (get_flag(6,5) == 0)) {
			reset_dialog();
			add_dialog_str(0,"You begin your bitter-sweet journey to Sharimik. You defeated the chieftain of the ogres, but it was too late: Passton had already been destroyed. During your journey you took some consolation in the fact that those responsible were dealt with.",0);
			add_dialog_str(1,"You had time to think it through on your days on the road. Perhaps there was something you could have done, but what is done is done. You move on. In Sharimik, the interesting job you were after is still available.",0);
			add_dialog_str(2,"You get it, complete it and life goes on.",0);
			add_dialog_choice(0,"THE END");
			run_dialog(1);
	}

		if ((get_flag(5,11) >= 1) && (get_flag(6,5) == 5)) {
			reset_dialog();
			add_dialog_str(0,"You begin your bitter-sweet journey to Sharimik. You defeated the chieftain of the ogres, but it was too late: Passton had already been destroyed. What is worse, the woman who instigated the destruction escaped.",0);
			add_dialog_str(1,"You had time to think things through on your days on the road. Why did she want Passton destroyed? Answers escaped with her and you found resolve in the thought that there was nothing you could have done to prevent what happened. You move on.",0);
			add_dialog_str(2,"In Sharimik, the interesting job you were after is still available. You get it, complete it and life goes on.",0);
			add_dialog_choice(0,"THE END");
			run_dialog(1);
	}

		end_scenario(1);
	}
}
 break;

beginstate 16;
	message_dialog("A flock of sheep grazes docilely on these grasslands. They must belong to the one of the inhabitants of the pass. The ogres have not bothered with the animals and they are very calm, even indifferent. You do not interest them at any rate.","However, some individual sheep try to engage in conversation with you, but their rhetoric does not convince you to stay and listen.");
	outdoor_enc_result(1);
 break;

beginstate 17;
	print_str_color("This house has been looted and burned.",2);
 break;

beginstate 18;
	if ((get_flag(110,3) == 0) && (get_flag(3,2) != 2)) {
		reset_dialog();
		add_dialog_str(0,"You notice that there are not that many ogres in their fort anymore; certainly fewer than before. It does not take a genius in ogre behavior to realize that the ogres were fired up for a fight when you dropped out of their fort.",0);
		add_dialog_str(1,"There is no way the ogres dispersed peacefully after Angerfist's speech and the only logical place to attack would be Passton.",0);
		add_dialog_str(2,"The town's garrison is far too few in numbers to withhold an ogre assault of that size. With your help, they might just succeed.",0);
		run_dialog(1);
		set_town_visibility(7,1);
		set_flag(110,3,1);
}
 break;

beginstate 19;
	message_dialog("There is a man hiding in this cave. Once you have convinced him that you are not an ogre (which wasn't that hard), he says his name is Jarmo. He says he's been hiding here ever since the ogres showed up. His supplies look like they might last very long.","That is why he refuses to leave. _I ain't going back home until Quarhag Pass is absolutely cleared of monsters._ Your words fail to persuade him to think it is safe outside.");
	set_flag(110,4,1);
	outdoor_enc_result(1);
	set_flag(0,12,2);
 break;

beginstate 20;
	if (get_flag(110,5) == 0) {
		message_dialog("You have found the ogre village. Like their fort, it is not very large. You are no doubt spotted by their sentries since there is a commotion going on in the village. However, the ogres are not gathering to repel you. They are fleeing.","A small group stays behind, however. They seem determined to stop your progress.");
		set_flag(110,5,1);
}
 break;

beginstate 21;
	message_dialog("Maybe this wasn't the smartest course of action. There really is a lot of ogres and they might overwhelm you.","");
 break;

beginstate 22;
	if ((get_flag(110,6) == 0) && (get_flag(6,5) == 0)) {
		message_dialog("A large group of ogres guards the northern exit of Quarhag Pass. You count almost twenty ogres and about half of them consist of the larger kind. There are also a few ogre magi dressed in red. It looks like the ogres have spotted you as well.","They are holding their ground thus blocking your way north. You are in for a tough fight if you wish to press onwards.");
		set_flag(110,6,1);
}
 break;

beginstate 23;
	if (get_flag(0,13) == 1) {
		message_dialog("The Passton garrison seems to be convinced that the ogres cannot be in this direction.","");
		block_entry(1);
}
 break;

beginstate 24;
	message_dialog("Having defeated the ogres you take a closer look around the battlefield. Like you first thought, the ogres have pretty much cleaned the site of anything valuable. There are some herbs and a few coins left in the last wagon.","However, they did leave a well-crafted suit of chain mail behind. Obviously the suit of armor was not in their size. You on the other hand have no such problems.");
	reward_give(214);
	reward_give(214);
	reward_give(218);
	reward_give(37);
	change_coins(120);
 break;

beginstate 25;
	reset_dialog();
	add_dialog_str(0,"There must be a hundred sheep here. They do what sheep do best: graze dumbly. They are docile creatures and therefore are not at all alarmed by your presence. You see no-one herding the sheep, though you'd guess these sheep belong to the ogres.",0);
	add_dialog_str(1,"Suddenly something strange happens. Some of the sheep closest to you stop their eating and stare you directly in the eye. The staring spreads to include roughly two dozen sheep. They begin to baa violently.",0);
	add_dialog_str(2,"The rest of the sheep bleat in panic and begin to run away. The ones left do something completely unexpected. They attack!",0);
	run_dialog(1);
 break;

beginstate 26;

	if ((get_skill_total(16) >= 10) && (get_flag(110,8) == 0)) {
		reset_dialog();
		add_dialog_str(0,"Just as you thought! This is a perfect ground for certain useful herbs to grow. They are thriving in this beneficial soil and only your wilderness skills allowed you to stop and look for them.",0);
		add_dialog_str(1,"There are enough herbs for several potions. Do you stop and gather them?",0);
		add_dialog_choice(0,"Pick herbs.");
		add_dialog_choice(1,"Leave.");
		choice = run_dialog(1);

	if (choice == 1) {
		set_flag(110,8,1);
		reward_give(214);
		reward_give(214);
		reward_give(215);
		reward_give(215);
		reward_give(216);
}
}
 break;

beginstate 27;
	message_dialog("The carnage is over. You have defeated the ogres and the way out of the pass is no open. The ogres had set up a temporary camp, but there is nothing of interest in there. You find only dirty sleeping pads and food of questionable origin.","");
	set_flag(152,7,1);
	break;
